<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>信息补录-危险性评估tab</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <style>
        .discell {
            text-align:right;
            width:150px;
        }
        .input {
            width:150px;
        }
        table {
            border-collapse:separate;
            border-spacing:10px;
        }
    </style>
</head>
<body>
<div class="mini-fit" style="padding-top:20px;margin-bottom:45px;">
    <!-- 用户 编辑框START-->
    <form id="form1" method="post">
        <input name="id" id="id" class="mini-hidden" value="${id!''}" readonly />
        <input name="priNum" id="priNum" class="mini-hidden" value="${priNum!''}" readonly />
        <table align="center" cellspacing="8">

            <tr>
                <td class="discell"><font color="#dc143c">*</font>是否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;特赦:</td>
                <td class="input">
                    <input name="amnesty" id="amnesty" class="mini-combobox"
                           data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                           textField="name" valueField="id" value="${amnesty!'2'}" required="true" />
                </td>
                <td class="discell"><font color="#dc143c">*</font>服刑期间再犯罪:</td>
                <td>
                    <input name="zfz" id="zfz" class="mini-combobox"
                           data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                           textField="name" valueField="id" value="${zfz!'2'}" required="true" onvaluechanged="zaifanzui()"  />
                </td>
            </tr>
            <tr>

                <td class="discell"><font color="#dc143c">*</font>死&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;亡:</td>
                <td>
                    <input name="death" id="death" class="mini-combobox"
                           data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                           textField="name" valueField="id" value="${death!'2'}" required="true" onvaluechanged="siwang()"/>
                </td>
                <td class="discell" id="zrsj"><font color="#dc143c">*</font>转入&nbsp;社区&nbsp;&nbsp;矫正:</td>
                <td colspan="3" id ="sfzrsj">
                    <input name="zrsqjz" id="zrsqjz" class="mini-combobox"
                           data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                           textField="name" valueField="id" value="${zrsqjz!'2'}" required="true" onvaluechanged="zhuanru()"/>
                </td>
            </tr>
            <tr id = "deathFlag">
                <td class="discell"><font color="#dc143c">*</font>死亡&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间:</td>
                <td >
                    <input property="editor" class="mini-datepicker" id="deathTime" name="deathTime" required="true" value="${deathTime!'2'}" allowInput="true" />
                </td>
            </tr>
            <tr>
                <td class="discell">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</td>
                <td colspan="3" class="showcell">
                    <input class="mini-textarea" style="width:410px;height: 100px" value="${baseRemark!''}" emptyText = "请输入..." id="baseRemark" name="baseRemark"/>
                </td>
            </tr>
        </table>
    </form>
</div>
<div style="width:100%;position:absolute;bottom:0;line-height: 45px;border-top: 1px solid #dfdfdf;text-align: center">
    <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px" onclick="saveData()">保存</a>
</div>


<script type="text/javascript">
    mini.parse();
    var form = new mini.Form("form1");
    var zfz = mini.get("zfz");
    var death = mini.get("death");
    var zrsqjz = mini.get("zrsqjz");
    var priNum = mini.get("priNum");
    var id = mini.get("id");
    var autoShowEle = document.getElementById("autoShow");

    window.onload = function () {
       if(death.getValue()=="2"){
            document.getElementById("deathFlag").setAttribute("hidden",true);
        }
        var role = "${role!''}";
        if(role == 'A21'){
            document.getElementById("zrsj").setAttribute("hidden",true);
            document.getElementById("sfzrsj").setAttribute("hidden",true);
        }
    }

    function saveData() {
        var death = mini.get("death").getValue();
        if(death == '1'){
            var deathTime = mini.get("deathTime").getValue();
            if(deathTime == undefined || deathTime == ""){
                mini.alert("请输入死亡时间");
                return;
            }
        }
        var data = form.getData();
        var json = mini.encode(data);
        $.ajax({
            url: "/azbj/wxxpg/saveBaseInfo",
            data: {data: json},
            type: "post",
            success: function (success) {
                if (success.code == 1) {
                    mini.alert("保存成功");
                } else {
                    mini.alert("保存失败");
                }
            }
        });
    }

    function onIsChange(e) {

        if ("sanwu" == e) {
            var sanwuValue = sanwu.getValue();
            var sanjaValue = sanjia.getValue();
            var row = document.getElementById("sanwushow");
            var swshow = document.getElementById("swshow");
            var sjshow = document.getElementById("sjshow");
            var cell3 = document.getElementById("noshow");
            mini.get("wujia").setValue('false');
            mini.get("wuqin").setValue('false');
            mini.get("wuye").setValue('false');
            if (row != null) {
                if (sanwuValue == 1 && sanjaValue == 1) {
                    swshow.style.display = "table-cell";
                    sjshow.style.display = "table-cell";
                    cell3.style.display = "none";
                } else if (sanwuValue == 1 && sanjaValue != 1) {
                    row.style.display = "table-row";
                    swshow.style.display = "table-cell";
                    sjshow.style.display = "none";
                    cell3.style.display = "none";
                } else if (sanwuValue != 1 && sanjaValue == 1) {
                    swshow.style.display = "none";
                    sjshow.style.display = "table-cell";
                    cell3.style.display = "table-cell";
                } else if (sanwuValue != 1 && sanjaValue != 1) {
                    row.style.display = "none";
                }
            }
            setPingGu();
        } else if ("sanjia" == e) {
            var sanwuValue = sanwu.getValue();
            var sanjaValue = sanjia.getValue();
            var row = document.getElementById("sanwushow");
            var sjshow = document.getElementById("sjshow");
            var swshow = document.getElementById("swshow");
            var cell3 = document.getElementById("noshow");
            if (row != null) {
                if (sanjaValue == 1 && sanwuValue == 1) {
                    sjshow.style.display = "table-cell";
                    swshow.style.display = "table-cell";
                    cell3.style.display = "none";
                } else if (sanjaValue == 1 && sanwuValue != 1) {
                    row.style.display = "table-row";
                    swshow.style.display = "none";
                    sjshow.style.display = "table-cell";
                    cell3.style.display = "table-cell";
                } else if (sanjaValue != 1 && sanwuValue == 1) {
                    sjshow.style.display = "none";
                    swshow.style.display = "table-cell";
                    cell3.style.display = "none";
                } else {
                    row.style.display = "none";
                }
            }
            setPingGu();
        } else if ("wushe" == e) {
            var wsvalue = wushe.getValue();
            var ssvalue = sishi.getValue();
            var row = document.getElementById("wusheshow");
            var wsshow = document.getElementById("wsshow");
            var ssshow = document.getElementById("sshow");
            var cell3 = document.getElementById("noshow1");
            if (row != null) {
                if (wsvalue == 1 && ssvalue == 1) {
                    wsshow.style.display = "table-cell";
                    ssshow.style.display = "table-cell";
                    cell3.style.display = "none";
                } else if (wsvalue == 1 && ssvalue != 1) {
                    row.style.display = "table-row";
                    wsshow.style.display = "table-cell";
                    ssshow.style.display = "none";
                    cell3.style.display = "none";
                } else if (wsvalue != 1 && ssvalue == 1) {
                    wsshow.style.display = "none";
                    ssshow.style.display = "table-cell";
                    cell3.style.display = "table-cell";
                } else if (wsvalue != 1 && ssvalue != 1) {
                    row.style.display = "none";
                }
            }
        } else if ("sishi" == e) {
            var wsvalue = wushe.getValue();
            var ssvalue = sishi.getValue();
            var row = document.getElementById("wusheshow");
            var wsshow = document.getElementById("wsshow");
            var ssshow = document.getElementById("sshow");
            var cell3 = document.getElementById("noshow1");
            if (row != null) {
                if (ssvalue == 1 && wsvalue == 1) {
                    ssshow.style.display = "table-cell";
                    wsshow.style.display = "table-cell";
                    cell3.style.display = "none";
                } else if (ssvalue == 1 && wsvalue != 1) {
                    row.style.display = "table-row";
                    wsshow.style.display = "none";
                    ssshow.style.display = "table-cell";
                    cell3.style.display = "table-cell";
                } else if (ssvalue != 1 && wsvalue == 1) {
                    ssshow.style.display = "none";
                    wsshow.style.display = "table-cell";
                    cell3.style.display = "none";
                } else {
                    row.style.display = "none";
                }
            }
        } else if ("weifa" == e) {
            setPingGu();
        }

    }





    /**
     * 死亡不能编辑其他项，不进入后续的衔接流程
     */
    function siwang(){
        var deathValue = death.getValue();
        if(deathValue=="1"){
            document.getElementById("deathFlag").removeAttribute("hidden");
        }else{
            document.getElementById("deathFlag").setAttribute("hidden",true);
        }
    }

    /**
     * 转入社区矫正不能编辑其他项，不进入后续的衔接流程
     */


</script>
</body>
</html>